<html>
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
	<title>Document</title>
</head>
<body>
	<p>点击这里来创建变量，并显示结果。</p>
    <button onclick="myFunction()">点击这里</button>
    <p id="demo"></p>
    <p>假设 y=5，计算 x=y+2，并显示结果。</p>
    <button onclick="myFunction2()">点击这里</button>
    <p id="demo2"></p>
	<script type="text/javascript">
		var x=2;
		var y=3;
		var z=2+3;

		document.write(x + "<br>");
		document.write(y + "<br>");
		document.write(z + "<br>");

		var pi=3.14;
		var name="Bill Gates";
		var answer="Yes I am!";

		document.write(pi + "<br>");
		document.write(name + "<br>");
		document.write(answer + "<br>");

		function myFunction(){
			var carname="Volvo";
			document.getElementById("demo").innerHTML=carname;
		}

		function myFunction2(){
			var y = 5;
			var x = y + 2;
			document.getElementById("demo2").innerHTML="x=" + x;
		}
	</script>
</body>
</html>